package com.zhang.servicemap.controller;

import com.zhang.internalcommon.dto.ForecastPrceDTO;
import com.zhang.internalcommon.dto.ResponseResult;
import com.zhang.internalcommon.response.DirectionResponse;
import com.zhang.servicemap.service.DirectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ADMIN
 */
@RestController()
@RequestMapping("/direction")
public class DirectionController {

	@Autowired
	private DirectionService directionService;

	@PostMapping("/driving")
	public ResponseResult<DirectionResponse> driving(@RequestBody ForecastPrceDTO forecastPrceDTO) {
		String depLongitude = forecastPrceDTO.getDepLongitude();
		String depLatitude = forecastPrceDTO.getDepLatitude();
		String destLongitude = forecastPrceDTO.getDestLongitude();
		String destLatitude = forecastPrceDTO.getDestLatitude();

		ResponseResult driving = directionService.driving(depLongitude, depLatitude, destLongitude, destLatitude);
		return driving;
	}
}
